# src files
list(
  APPEND
  LIBHEVC_COMMON_SRCS
  "${HEVC_ROOT}/common/ithread.c"
  "${HEVC_ROOT}/common/ihevc_quant_tables.c"
  "${HEVC_ROOT}/common/ihevc_inter_pred_filters.c"
  "${HEVC_ROOT}/common/ihevc_weighted_pred.c"
  "${HEVC_ROOT}/common/ihevc_padding.c"
  "${HEVC_ROOT}/common/ihevc_deblk_edge_filter.c"
  "${HEVC_ROOT}/common/ihevc_deblk_tables.c"
  "${HEVC_ROOT}/common/ihevc_cabac_tables.c"
  "${HEVC_ROOT}/common/ihevc_common_tables.c"
  "${HEVC_ROOT}/common/ihevc_intra_pred_filters.c"
  "${HEVC_ROOT}/common/ihevc_chroma_intra_pred_filters.c"
  "${HEVC_ROOT}/common/ihevc_mem_fns.c"
  "${HEVC_ROOT}/common/ihevc_sao.c"
  "${HEVC_ROOT}/common/ihevc_trans_tables.c"
  "${HEVC_ROOT}/common/ihevc_recon.c"
  "${HEVC_ROOT}/common/ihevc_itrans.c"
  "${HEVC_ROOT}/common/ihevc_itrans_recon.c"
  "${HEVC_ROOT}/common/ihevc_iquant_recon.c"
  "${HEVC_ROOT}/common/ihevc_iquant_itrans_recon.c"
  "${HEVC_ROOT}/common/ihevc_itrans_recon_32x32.c"
  "${HEVC_ROOT}/common/ihevc_itrans_recon_16x16.c"
  "${HEVC_ROOT}/common/ihevc_itrans_recon_8x8.c"
  "${HEVC_ROOT}/common/ihevc_chroma_itrans_recon.c"
  "${HEVC_ROOT}/common/ihevc_chroma_iquant_recon.c"
  "${HEVC_ROOT}/common/ihevc_chroma_iquant_itrans_recon.c"
  "${HEVC_ROOT}/common/ihevc_chroma_recon.c"
  "${HEVC_ROOT}/common/ihevc_chroma_itrans_recon_16x16.c"
  "${HEVC_ROOT}/common/ihevc_chroma_itrans_recon_8x8.c"
  "${HEVC_ROOT}/common/ihevc_buf_mgr.c"
  "${HEVC_ROOT}/common/ihevc_disp_mgr.c"
  "${HEVC_ROOT}/common/ihevc_dpb_mgr.c"
  "${HEVC_ROOT}/common/ithread.c"
  "${HEVC_ROOT}/common/ihevc_cabac_tables.c"
  "${HEVC_ROOT}/common/ihevc_chroma_intra_pred_filters.c"
  "${HEVC_ROOT}/common/ihevc_chroma_itrans_recon.c"
  "${HEVC_ROOT}/common/ihevc_chroma_itrans_recon_16x16.c"
  "${HEVC_ROOT}/common/ihevc_chroma_itrans_recon_8x8.c"
  "${HEVC_ROOT}/common/ihevc_common_tables.c"
  "${HEVC_ROOT}/common/ihevc_deblk_edge_filter.c"
  "${HEVC_ROOT}/common/ihevc_deblk_tables.c"
  "${HEVC_ROOT}/common/ihevc_hbd_deblk_edge_filter.c"
  "${HEVC_ROOT}/common/ihevc_inter_pred_filters.c"
  "${HEVC_ROOT}/common/ihevc_intra_pred_filters.c"
  "${HEVC_ROOT}/common/ihevc_iquant_recon.c"
  "${HEVC_ROOT}/common/ihevc_itrans_recon.c"
  "${HEVC_ROOT}/common/ihevc_itrans_recon_16x16.c"
  "${HEVC_ROOT}/common/ihevc_itrans_recon_32x32.c"
  "${HEVC_ROOT}/common/ihevc_itrans_recon_8x8.c"
  "${HEVC_ROOT}/common/ihevc_mem_fns.c"
  "${HEVC_ROOT}/common/ihevc_padding.c"
  "${HEVC_ROOT}/common/ihevc_quant_iquant_ssd.c"
  "${HEVC_ROOT}/common/ihevc_quant_tables.c"
  "${HEVC_ROOT}/common/ihevc_resi_trans.c"
  "${HEVC_ROOT}/common/ihevc_sao.c"
  "${HEVC_ROOT}/common/ihevc_trans_tables.c"
  "${HEVC_ROOT}/common/ihevc_weighted_pred.c")

include_directories(${HEVC_ROOT}/common)

# arm/x86 sources
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
  list(
    APPEND
    LIBHEVC_COMMON_ASMS
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_filters_neon_intr.c"
    "${HEVC_ROOT}/common/arm/ihevc_quant_iquant_ssd_neon_intr.c"
    "${HEVC_ROOT}/common/arm/ihevc_weighted_pred_neon_intr.c"
    "${HEVC_ROOT}/common/arm/ihevc_resi_trans_neon_32x32.c"
    "${HEVC_ROOT}/common/arm/ihevc_resi_trans_neon.c"
    "${HEVC_ROOT}/common/arm/ihevc_intra_ref_substitution_a9q.c"
    "${HEVC_ROOT}/common/arm64/ihevc_deblk_chroma_horz.s"
    "${HEVC_ROOT}/common/arm64/ihevc_deblk_chroma_vert.s"
    "${HEVC_ROOT}/common/arm64/ihevc_deblk_luma_horz.s"
    "${HEVC_ROOT}/common/arm64/ihevc_deblk_luma_vert.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_chroma_copy.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_chroma_copy_w16out.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_chroma_horz.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_chroma_horz_w16out.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_chroma_vert.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_chroma_vert_w16inp.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_chroma_vert_w16inp_w16out.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_chroma_vert_w16out.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_filters_luma_horz.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_filters_luma_vert.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_filters_luma_vert_w16inp.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_filters_luma_vert_w16out.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_luma_copy.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_luma_copy_w16out.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_luma_horz_w16out.s"
    "${HEVC_ROOT}/common/arm64/ihevc_inter_pred_luma_vert_w16inp_w16out.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_chroma_dc.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_chroma_horz.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_chroma_mode_18_34.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_chroma_mode_27_to_33.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_chroma_mode2.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_chroma_mode_3_to_9.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_chroma_planar.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_chroma_ver.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_filters_chroma_mode_11_to_17.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_filters_chroma_mode_19_to_25.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_filters_luma_mode_11_to_17.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_filters_luma_mode_19_to_25.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_luma_dc.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_luma_horz.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_luma_mode_18_34.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_luma_mode_27_to_33.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_luma_mode2.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_luma_mode_3_to_9.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_luma_planar.s"
    "${HEVC_ROOT}/common/arm64/ihevc_intra_pred_luma_vert.s"
    "${HEVC_ROOT}/common/arm64/ihevc_itrans_recon_16x16.s"
    "${HEVC_ROOT}/common/arm64/ihevc_itrans_recon_32x32.s"
    "${HEVC_ROOT}/common/arm64/ihevc_itrans_recon_4x4.s"
    "${HEVC_ROOT}/common/arm64/ihevc_itrans_recon_4x4_ttype1.s"
    "${HEVC_ROOT}/common/arm64/ihevc_itrans_recon_8x8.s"
    "${HEVC_ROOT}/common/arm64/ihevc_mem_fns.s"
    "${HEVC_ROOT}/common/arm64/ihevc_neon_macros.s"
    "${HEVC_ROOT}/common/arm64/ihevc_padding.s"
    "${HEVC_ROOT}/common/arm64/ihevc_sao_band_offset_chroma.s"
    "${HEVC_ROOT}/common/arm64/ihevc_sao_band_offset_luma.s"
    "${HEVC_ROOT}/common/arm64/ihevc_sao_edge_offset_class0_chroma.s"
    "${HEVC_ROOT}/common/arm64/ihevc_sao_edge_offset_class0.s"
    "${HEVC_ROOT}/common/arm64/ihevc_sao_edge_offset_class1_chroma.s"
    "${HEVC_ROOT}/common/arm64/ihevc_sao_edge_offset_class1.s"
    "${HEVC_ROOT}/common/arm64/ihevc_sao_edge_offset_class2_chroma.s"
    "${HEVC_ROOT}/common/arm64/ihevc_sao_edge_offset_class2.s"
    "${HEVC_ROOT}/common/arm64/ihevc_sao_edge_offset_class3_chroma.s"
    "${HEVC_ROOT}/common/arm64/ihevc_sao_edge_offset_class3.s"
    "${HEVC_ROOT}/common/arm64/ihevc_weighted_pred_bi_default.s"
    "${HEVC_ROOT}/common/arm64/ihevc_weighted_pred_bi.s"
    "${HEVC_ROOT}/common/arm64/ihevc_weighted_pred_uni.s")

  include_directories(${HEVC_ROOT}/common/arm64 ${HEVC_ROOT}/common/arm)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch32")
  list(
    APPEND
    LIBHEVC_COMMON_ASMS
    "${HEVC_ROOT}/common/arm/ihevc_cmn_utils_neon.h"
    "${HEVC_ROOT}/common/arm/ihevc_deblk_chroma_horz.s"
    "${HEVC_ROOT}/common/arm/ihevc_deblk_chroma_vert.s"
    "${HEVC_ROOT}/common/arm/ihevc_deblk_luma_horz.s"
    "${HEVC_ROOT}/common/arm/ihevc_deblk_luma_vert.s"
    "${HEVC_ROOT}/common/arm/ihevc_func_selector.h"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_chroma_copy.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_chroma_copy_w16out.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_chroma_horz.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_chroma_horz_w16out.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_chroma_vert.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_chroma_vert_w16inp.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_chroma_vert_w16inp_w16out.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_chroma_vert_w16out.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_filters_luma_horz.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_filters_luma_vert.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_filters_luma_vert_w16inp.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_luma_copy.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_luma_copy_w16out.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_luma_horz_w16out.s"
    "${HEVC_ROOT}/common/arm/ihevc_inter_pred_luma_vert_w16inp_w16out.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_chroma_dc.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_chroma_horz.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_chroma_mode_18_34.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_chroma_mode_27_to_33.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_chroma_mode2.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_chroma_mode_3_to_9.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_chroma_planar.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_chroma_ver.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_filters_chroma_mode_11_to_17.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_filters_chroma_mode_19_to_25.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_filters_luma_mode_11_to_17.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_filters_luma_mode_19_to_25.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_filters_neon_intr.c"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_luma_dc.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_luma_horz.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_luma_mode_18_34.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_luma_mode_27_to_33.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_luma_mode2.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_luma_mode_3_to_9.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_luma_planar.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_pred_luma_vert.s"
    "${HEVC_ROOT}/common/arm/ihevc_intra_ref_substitution_a9q.c"
    "${HEVC_ROOT}/common/arm/ihevc_itrans_recon_16x16.s"
    "${HEVC_ROOT}/common/arm/ihevc_itrans_recon_32x32.s"
    "${HEVC_ROOT}/common/arm/ihevc_itrans_recon_4x4.s"
    "${HEVC_ROOT}/common/arm/ihevc_itrans_recon_4x4_ttype1.s"
    "${HEVC_ROOT}/common/arm/ihevc_itrans_recon_8x8.s"
    "${HEVC_ROOT}/common/arm/ihevc_mem_fns.s"
    "${HEVC_ROOT}/common/arm/ihevc_padding.s"
    "${HEVC_ROOT}/common/arm/ihevc_platform_macros.h"
    "${HEVC_ROOT}/common/arm/ihevc_quant_iquant_ssd_neon_intr.c"
    "${HEVC_ROOT}/common/arm/ihevc_resi_trans_32x32_a9q.s"
    "${HEVC_ROOT}/common/arm/ihevc_resi_trans_neon_32x32.c"
    "${HEVC_ROOT}/common/arm/ihevc_resi_trans_neon.c"
    "${HEVC_ROOT}/common/arm/ihevc_resi_trans.s"
    "${HEVC_ROOT}/common/arm/ihevc_sao_band_offset_chroma.s"
    "${HEVC_ROOT}/common/arm/ihevc_sao_band_offset_luma.s"
    "${HEVC_ROOT}/common/arm/ihevc_sao_edge_offset_class0_chroma.s"
    "${HEVC_ROOT}/common/arm/ihevc_sao_edge_offset_class0.s"
    "${HEVC_ROOT}/common/arm/ihevc_sao_edge_offset_class1_chroma.s"
    "${HEVC_ROOT}/common/arm/ihevc_sao_edge_offset_class1.s"
    "${HEVC_ROOT}/common/arm/ihevc_sao_edge_offset_class2_chroma.s"
    "${HEVC_ROOT}/common/arm/ihevc_sao_edge_offset_class2.s"
    "${HEVC_ROOT}/common/arm/ihevc_sao_edge_offset_class3_chroma.s"
    "${HEVC_ROOT}/common/arm/ihevc_sao_edge_offset_class3.s"
    "${HEVC_ROOT}/common/arm/ihevc_weighted_pred_bi_default.s"
    "${HEVC_ROOT}/common/arm/ihevc_weighted_pred_bi.s"
    "${HEVC_ROOT}/common/arm/ihevc_weighted_pred_neon_intr.c"
    "${HEVC_ROOT}/common/arm/ihevc_weighted_pred_uni.s")

  include_directories(${HEVC_ROOT}/common/arm)
else()
  list(
    APPEND
    LIBHEVC_COMMON_SRCS
    "${HEVC_ROOT}/common/x86/ihevc_inter_pred_filters_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_weighted_pred_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_intra_pred_filters_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_chroma_intra_pred_filters_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_itrans_recon_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_itrans_recon_16x16_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_itrans_recon_32x32_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_sao_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_deblk_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_padding_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_mem_fns_ssse3_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_inter_pred_filters_sse42_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_weighted_pred_sse42_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_intra_pred_filters_sse42_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_chroma_intra_pred_filters_sse42_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_itrans_recon_sse42_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_16x16_itrans_recon_sse42_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_32x32_itrans_recon_sse42_intr.c"
    "${HEVC_ROOT}/common/x86/ihevc_tables_x86_intr.c")

  include_directories(${HEVC_ROOT}/common/x86)
endif()
